<template>
	<view class="works-list">
		<view class="" v-if="list.length!=0">
			<view class="item" v-for="item in newList" @click="handDetails(item)">
				<u-image border-radius='12' :fade="true" duration="450" width="100%" height="346rpx" :src="item.titleImg" mode=""></u-image>
				<view class="title">
					{{item.title}}
				</view>
			</view>
			<view class="mb-30 mt-30">
				<u-loadmore :status="status"></u-loadmore>
			</view>
		</view>
		<u-empty margin-top='20' font-size='24' icon-size='80' :show='list.length==0' :text="onMsg"></u-empty>
	</view>
</template>

<script>
	export default {
		props: {
			onMsg: {
				type: String,
				default: '暂无作品申报'
			},
			status: {
				type: String,
				default: 'nomore',
			},
			list: {
				type: Array,
				default: () => []
			},
			//自定义key
			props: {
				type: Object,
				default: () => {}
			}
		},
		computed: {
			newList() {
				//根据传入的key 修改默认key
				if ('{}' != JSON.stringify(this.props) && this.props) {
					for (var i = 0; i < this.list.length; i++) {
						var obj = this.list[i];
						for (var key in obj) {
							var newKey = this.props[key];
							if (newKey) {
								obj[newKey] = obj[key];
								delete obj[key];
							}
						}
					}
				}
				return this.list
			}
		},
		data() {
			return {

			};
		},
		methods: {
			handDetails(item) {
				this.$emit('handDetails', item)
			}
		}
	}
</script>

<style lang="scss">
	.works-list {
		padding: 40rpx 30rpx;

		.item {
			margin-bottom: 50rpx;

			.title {
				font-size: $bs-font-size-32;
				color: #000;
				margin-top: 20rpx;
			}
		}

	}
</style>
